﻿namespace CSharpPro2._1009;

public class Demo
{
    //作业一
    public class TestPrint1
    {
        public static void Test1()
        {
            for (int i = 100; i < 1000; i++)
            {

                int g = i % 10;
                int s = (i / 10) % 10;
                int b = i / 100;
                int result = (int)(Math.Pow(g, 3) + Math.Pow(s, 3) + Math.Pow(b, 3));
                if (result == i)
                {
                    Console.WriteLine(i);
                }
            }
        }
    }

    //作业二
    public class TestPrint2
    {
        public static void Test2()
        {

            for (int num = 2; num <= 100; num++)
            {
                bool isPrime = true;

                for (int i = 2; i < num; i++)
                {

                    if (num % i == 0)
                    {
                        isPrime = false;
                        break;
                    }
                }

                if (isPrime)
                {
                    Console.Write(num + " ");
                }
            }
        }
    }
}
